<!DOCTYPE html>

<?php
require_once 'inc/functions.php';

SetLocale(LC_ALL, "cs_CZ");
session_start();
$pinfo = $_SESSION['pinfo'];  
?>

<html>
    <head>
        <title><?PHP echo "Vogon: ".$pinfo['Login']?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="inc/styles.css">
    </head>
<body>
      
    
<table border="0" width="100%">
    <tbody> <?PHP 
            if     (!AmIAdmin())        echo '<tr class="userHeader">'; 
            elseif (!isset($pinfo))     echo '<tr class="adminAsNobodyHeader">';
            elseif ($pinfo['id']==$_SESSION['lid']) echo '<tr class="adminAsHimHeader">';
            else echo '<tr class="adminAsUserHeader">'
            ?>   
        
             <?PHP  /*  
                // Granty
                echo '<td align="left">';   
                $sql = sprintf( "SELECT `projects`.* FROM `PeopleInProjects`, `projects`"
                            ." WHERE `PeopleInProjects`.person = '%d' AND `projects`.id = `PeopleInProjects`.project", 
                            $_SESSION['pinfo']['id']);
                    //echo $sql;
                    $res = mysql_query($sql) or die(mysql_error());

                    while ($row = mysql_fetch_assoc($res)) { 
                        //print_r($row);
                        printf("%s[%s] ", $row['Name'], $row['Short']);
                    }
                    mysql_free_result($res);
                echo '</td>';
              * 
              */
             ?>
            
            
            <td align="right"> <div>
                <?php 
                    require_once 'changePerson.php';                    
                    if (AmIAdmin())  {
                        printf('Admin <b>%s</b>', $_SESSION['linfo']['Login']) ;
                        if (isset($pinfo)) printf(' jako <b>%s</b>', PersonName($pinfo)); 
                    } else
                        print(PersonName($pinfo));
                ?>
            </div></td>
            
            <?php 
                require_once 'changePerson.php';                    
                if (AmIAdmin())  {
                    echo '<td align="center" width="110px"> <div>';
                    GenerateChangePersonForm("vogoni.php"); 
                    echo '</div></td>';
                } 
            ?>

            <td align="right" width="50"> <a href="logout.php">Logout</a></td>
        </tr>
    </tbody>
</table>
